using MediatR;
using B.S.RbacData.ErrorCode;
using SupplierCustomerManagement.Domain.Enums;
using System.ComponentModel.DataAnnotations;

namespace SupplierCustomerManagement.Write.API.Applications.Commands.bankaccounts
{
    /// <summary>
    /// 新增银行账户命令
    /// </summary>
    public class AddBankAccountCommand : IRequest<ApiResult<int>>
    {
        /// <summary>
        /// 关联实体ID（客户ID或供应商ID）
        /// </summary>
        [Required(ErrorMessage = "关联实体ID不能为空")]
        public int RelatedEntityId { get; set; }

        /// <summary>
        /// 关联实体类型（Customer/Supplier）
        /// </summary>
        [Required(ErrorMessage = "关联实体类型不能为空")]
        public EntityType RelatedEntityType { get; set; }

        /// <summary>
        /// 银行名称
        /// </summary>
        [Required(ErrorMessage = "银行名称不能为空")]
        [StringLength(100, ErrorMessage = "银行名称长度不能超过100个字符")]
        public string BankName { get; set; } = string.Empty;

        /// <summary>
        /// 账户名称
        /// </summary>
        [Required(ErrorMessage = "账户名称不能为空")]
        [StringLength(100, ErrorMessage = "账户名称长度不能超过100个字符")]
        public string AccountName { get; set; } = string.Empty;

        /// <summary>
        /// 开户行
        /// </summary>
        [Required(ErrorMessage = "开户行不能为空")]
        [StringLength(200, ErrorMessage = "开户行长度不能超过200个字符")]
        public string OpeningBank { get; set; } = string.Empty;

        /// <summary>
        /// 账户号码
        /// </summary>
        [Required(ErrorMessage = "账户号码不能为空")]
        [StringLength(50, ErrorMessage = "账户号码长度不能超过50个字符")]
        public string AccountNumber { get; set; } = string.Empty;

        /// <summary>
        /// 账户类型（银行卡/存折）
        /// </summary>
        [Required(ErrorMessage = "账户类型不能为空")]
        public AccountType AccountType { get; set; }

        /// <summary>
        /// 账户属性（公司/个人）
        /// </summary>
        [Required(ErrorMessage = "账户属性不能为空")]
        public AccountProperty AccountProperty { get; set; }

        /// <summary>
        /// 账户关系类型
        /// </summary>
        public AccountRelationshipType? AccountRelationshipType { get; set; }

        /// <summary>
        /// 手机号码
        /// </summary>
        [StringLength(20, ErrorMessage = "手机号码长度不能超过20个字符")]
        public string? MobileNumber { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        [StringLength(18, ErrorMessage = "身份证号长度不能超过18个字符")]
        public string? IdNumber { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500, ErrorMessage = "备注长度不能超过500个字符")]
        public string? Remarks { get; set; }
    }
}